﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Autofac;
using TutorCenter.DataAccess.DataContext;
using TutorCenter.DataAccess.Entity;
using TutorCenter.DataAccess.Repository;
using TutorCenter.Service.Services;
using TutorCenter.Service.Services.Implement;

namespace TutorCenter.Service.DIConfigure
{
    public class RegisterIoC
    {
        public static void Configure(ContainerBuilder builder)
        {
            builder.RegisterType<DataContext>().As<DbContext>().InstancePerLifetimeScope();
            builder.RegisterType<UnitOfWork>().As<IUnitOfWork>().InstancePerRequest();
            builder.RegisterType<GenericRepository<Parent>>().As<IGenericRepository<Parent>>();
            builder.RegisterType<GenericRepository<Subject>>().As<IGenericRepository<Subject>>();
            builder.RegisterType<GenericRepository<Grade>>().As<IGenericRepository<Grade>>();
        }
    }
}
